package com.yuneec.fly.dialogs;

import android.annotation.SuppressLint;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.TextView;

import com.yuneec.fly.R;

/**
 * Created by jw.gu on 2016/6/25.
 */
@SuppressLint("ValidFragment")
public class WarningDialog extends BaseDialogFragment {
    private String message;

    public WarningDialog(String message) {
        super();
        this.message = message;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
        getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        View view = inflater.inflate(R.layout.dialog_warning, container);

        ((TextView) view.findViewById(R.id.dialogMessage)).setText(message);

        (view.findViewById(R.id.cancelIV)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
        return view;
    }
}
